home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / src / GLperf3.12-src.lha / GLperf / PropList.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-01  |  2.3 KB  |  70 lines

  1. /*
  2. //   (C) COPYRIGHT International Business Machines Corp. 1993
  3. //   All Rights Reserved
  4. //   Licensed Materials - Property of IBM
  5. //   US Government Users Restricted Rights - Use, duplication or
  6. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. //
  8.  
  9. //
  10. // Permission to use, copy, modify, and distribute this software and its
  11. // documentation for any purpose and without fee is hereby granted, provided
  12. // that the above copyright notice appear in all copies and that both that
  13. // copyright notice and this permission notice appear in supporting
  14. // documentation, and that the name of I.B.M. not be used in advertising
  15. // or publicity pertaining to distribution of the software without specific,
  16. // written prior permission. I.B.M. makes no representations about the
  17. // suitability of this software for any purpose.  It is provided "as is"
  18. // without express or implied warranty.
  19. //
  20. // I.B.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  21. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL I.B.M.
  22. // BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  23. // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  24. // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  25. // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  26. //
  27. // Author:  John Spitzer, IBM AWS Graphics Systems (Austin)
  28. //
  29. */
  30.  
  31. #include "PropList.h"
  32. #include <malloc.h>
  33.  
  34. const int propListInc = 10;
  35.  
  36. PropertyListPtr new_PropertyList()
  37. {
  38.     PropertyListPtr this = (PropertyListPtr)malloc(sizeof(PropertyList));
  39.     CheckMalloc(this);
  40.     this->num = 0;
  41.     this->max = propListInc;
  42.     this->list = (PropertyPtr*)malloc(sizeof(PropertyPtr)*this->max);
  43.     CheckMalloc(this->list);
  44.     return this;
  45. }
  46.  
  47. void delete_PropertyList(PropertyListPtr this)
  48. {
  49.     int i;
  50.     for (i=0; i<this->num; i++)
  51.     delete_Property(this->list[i]);
  52.     free(this->list);
  53.     free(this);
  54. }
  55.  
  56. int PropertyList__Size(PropertyListPtr this)
  57. {
  58.     return this->num;
  59. }
  60.  
  61. void PropertyList__AddProperty(PropertyListPtr this, PropertyPtr p)
  62. {
  63.     if (this->num == this->max) {
  64.         /* Extend list size by propListInc amount */
  65.         this->max += propListInc;
  66.         this->list = (PropertyPtr*)realloc(this->list, sizeof(PropertyPtr)*this->max);
  67.     }
  68.     this->list[this->num++] = p;
  69. }
  70.